﻿using System;
using DsLib;

namespace DNF.WCF.Service
{
	public class BSTService<T> : IBSTService<T> where T : IComparable<T>
	{
        BinarySearchTree<T> tree = new BinarySearchTree<T>();

        public void Add(T toAdd)
        {
            tree.Add(toAdd);
        }

        public bool Contains(T toSearch)
        {
            return tree.Contains(toSearch);
        }

        public bool Remove(T toRemove)
        {
            return tree.Remove(toRemove);
        }

        public string GetTraversePath(TreeTraversalType type)
        {
            return tree.GetTraversePath(TreeTraversalType.InOrder);
        }

        public void PrintTraversePath(TreeTraversalType type)
        {
            tree.TraverseAndPrint(TreeTraversalType.InOrder);
        }

        public void PrintValueStatusInBST(T toSearch)
        {
            tree.PrintValueStatusInBST(toSearch);
        }
	}
}
